]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dialog: Ensure action callback is called with no arguments
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 19 Apr 2021 16:37:58 +0000 (18:37 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 19 Apr 2021 17:12:59 +0000 (19:12 +0200)
Using the callback directly as signal handler means that it will
receive the signal parameters (in this case: the StButton instance
that emits the signal).

This leaks an implementation detail that is harmless in the best
case, but can break dialogs when using bind() on the callback.

Avoid that trap by explicitly calling the callback without arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4139

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1819>

js/ui/dialog.js

index 3e8bfee7d53c5d8723edabea48886a92786512ef..9513a8151a0fbafe6d68c83e1ef4a83c9062ba53 100644 (file)
@@ -133,7 +133,7 @@ class Dialog extends St.Widget {
             y_expand: true,
             label,
         });
-        button.connect('clicked', action);
+        button.connect('clicked', () => action());
 
         buttonInfo['button'] = button;